package com.lsa.skienna.challenge.chap2;

import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;

public class JollyJumpers implements Runnable{
	/**
	 * @param args
	 * @throws IOException 
	 */
	public static void main(String[] args) throws IOException {
		new JollyJumpers().run();
	}
	
	static boolean isJolly(int[] task) {
		if (task.length == 1) return true;
		
		Set<Integer> jollySequence = new HashSet<Integer>();
		
		for (int i = 1; i < task.length; i++) {
			jollySequence.add(i);
		}
		
		for (int i = 1; i < task.length; i++) {
			int diff = Math.abs(task[i] - task[i-1]);
			if (!jollySequence.remove(diff)){
				return false;
			}
		}
		
		return jollySequence.isEmpty();
	}

	static class TaskReader{
		private BufferedReader reader;
		
		TaskReader(InputStream stream) {
			this.reader = new BufferedReader(new InputStreamReader(stream));
		}
		
		int[] readNextTask() throws IOException{
			int[] task = null;
			
			String line = reader.readLine();
			if (line == null){
				return null;
			}
			
			Scanner scanner = new Scanner(line);
			int n = 0;
			
			try{
				n = scanner.nextInt();
				task = new int[n];
				
				for(int i = 0; i < n; ++i){
					scanner.skip(" ");
					task[i] = scanner.nextInt();
				}
			}
			catch(RuntimeException e){
				return null;
			}
			
			
			return task;
		}
	}
	
	static class ResultWriter{
		private static final String lineSeparator = System.getProperty("line.separator");
		
		private BufferedWriter writer;
		ResultWriter(OutputStream stream) {
			this.writer = new BufferedWriter(new OutputStreamWriter(stream));
		}
		
		void write(boolean isJolly) throws IOException{
			writer.write(isJolly? "Jolly" : "Not jolly");
			writer.write(lineSeparator);
			writer.flush();
		}
	}

	@Override
	public void run() {
		try {
			TaskReader taskReader = new TaskReader(System.in);
			ResultWriter resultWriter = new ResultWriter(System.out);
			int[] task;
			while((task = taskReader.readNextTask())!= null){
				resultWriter.write(isJolly(task));
			}
		} catch (IOException e) {
			e.printStackTrace();
		}
	}
}
